import apis from "../../http/apis/apis"
export default {
    namespaced: true,
    state: {
        orders: [],
        dataPage: {
            pageSize: 5,
            currentPage: 1,
            total: 10,
            isDelete: false,

        }
    },
    gatters: {

    },
    mutations: {
        getOrders(state, data) {
            state.orders = data.data;
            state.dataPage.total = data.total;
        },
        setPageData(state, newPageData) {
            state.dataPage = newPageData;
        },
        setCurrentPage(state, newCurrentPage) {
            state.dataPage.currentPage = newCurrentPage;
        },
        setPageSize(state, newPageSize) {
            state.dataPage.pageSize = newPageSize
        }
    },
    actions: {
        async getOrders(context, param) {
            const { data } = await apis.adminOrders.getOrders(param);
            context.commit('getOrders', data);
        },
    }

}